#ifndef MYHIGHLIGHT_H
#define MYHIGHLIGHT_H

#include <QObject>
#include<QSyntaxHighlighter>
class MyHighlight:public QSyntaxHighlighter
{
public:
    explicit MyHighlight(QTextDocument *parent = nullptr);
protected:
    void highlightBlock(const QString &text);
private:
    struct HighlightRule{
        QRegExp pattern;
        QTextCharFormat format;
    };

    QString mFontFamily = "Consolas" ;
    int mFontSize =14 ;

    QVector<HighlightRule> highlightRules;

    void addNormalTextFormat();
    void addNumberTextFormat();
    void addStringTextFormat();
    void addCommentTextFormat();
    void addmulLineTextFormat(const QString &text);
    void addKeyWordsFormat();
    void addClassNameFormat();
    void addFunctionFormat();
};

#endif // MYHIGHLIGHT_H
